// Copyright personal possession of Nguyen Minh Kha
// Datetime: 07:32PM 10/28/2011
// Discription: This class manage all game eventable object.
// Licencse: Free source
// Version: 1.0
// Writer: Nguyen Minh Kha

/* Google opensource coding standard with variable name exception */

#ifndef GAMEFRAMEWORK_EVENTABLE_MANAGER_H_
#define GAMEFRAMEWORK_EVENTABLE_MANAGER_H_

#include <Windows.h>

#include "eventable_object.h"

class EventableManager
{
  /* Struct */
private:
  struct List{
    EventableObject *object;
    List *pNext;
  };

  /* Static */
  
  static EventableManager* thisPointer;
public:
  static EventableManager* getInstance() {return EventableManager::thisPointer;}

  /* Constructor; Destructor */

public:
  EventableManager(void);
  ~EventableManager(void);

  /* Method */

public:

  void Add(EventableObject *object);
  void Delete(EventableObject *object);
  void RemoveAll();

  //
  // Fire event to specific object.
  //    objectId: id of object that listen to this event
  //    params:   parameters pass to object to execute.
  //
  void FireEvent(int objectId, LPWSTR* params);

  // Fire event to all object
  void FireAll(LPWSTR* params);

  //
  // Eventable object loop in thread.
  //
  void Threading();

  /* Data member */

private:
  List* pHead;
};

#endif // GAMEFRAMEWORK_EVENTABLE_MANAGER_H_

